package com.jt.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jt.pojo.Advice;
import com.jt.pojo.Item;
import com.jt.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface AdviceMapper extends BaseMapper<Advice>{


//    List<Advice> findAll();

    @Insert("insert into advice value(null,#{sitId},#{empId},#{advTime},#{reason},#{result},#{created},#{updated})")
    void addAdvice(Advice advice);

    @Delete("delete from advice where id=#{id}")
    void deleteAdviceById(Integer id);

    @Select("select * from advice where id=#{id}")
    Advice findAdviceById(Integer id);

    @Update("update advice set sit_id=#{sitId},emp_id=#{empId},adv_time=#{advTime},reason=#{reason},result=#{result} where id=#{id}")
    void updateAdvice(Advice advice);


    List<Advice> findAdviceList(@Param("query") String query,
                                @Param("size") int size,
                                @Param("startNum") int startNum);
    long findCount(String query);

}
